﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TianShiProject.Models.Common;
using TianShiProject.Models.Contract;
using TianShiProject.Models.Contract.NewTransportConts;
using Volo.Abp.Application.Services;

namespace TianShiProject.Contract.NewTransportConts
{
    public class NewTranApp: ApplicationService
    {
        private readonly INewTranAppRepository _newTranAppRepository;

        public NewTranApp (INewTranAppRepository newTranAppRepository)
        {
            _newTranAppRepository = newTranAppRepository;
        }

        /// <summary>
        /// 显示承运合同
        /// </summary>
        /// <returns></returns>
        public async Task<PageResponse<NewTransportContDtos>> GetNewTransport(string telet, string danwei, string principal, string operators, string dtime, int? state, int pageindex = 1, int pagesize = 5)
        {
            try
            {
                var list = await _newTranAppRepository.GetNewTransport(telet, danwei, principal, operators, dtime, state, pageindex, pagesize);
                return list;
            }
            catch (Exception)
            {

                throw;
            }

        }

        /// <summary>
        /// 删除承运合同
        /// </summary>
        /// <returns></returns>
        public async Task<PageResponse<NewTransportCont>> DeleteNewTransport(int Id)
        {
            try
            {
                return await _newTranAppRepository.DeleteNewTransport(Id);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 修改承运数据
        /// </summary>
        /// <param name="newOwner"></param>
        /// <returns></returns>
        public async Task<PageResponse<int>> UpdateNewTransport(NewTransportContDtos newOwner)
        {
            try
            {
                return await _newTranAppRepository.UpdateNewTransport(newOwner);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 添加承运合同
        /// </summary>
        /// <param name="newOwner"></param>
        /// <returns></returns>

        public async Task<PageResponse<int>> PostNewTransport(NewTransportCont newOwner)
        {
            try
            {
                return await _newTranAppRepository.PostNewTransport(newOwner);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 承运批量删除
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public async Task<PageResponse<NewTransportContDto>> DeletEmoreNewTrans(string Id)
        {
            try
            {
                return await _newTranAppRepository.DeletEmoreNewTrans(Id);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
